webpackJsonp([7],{

/***/ 323:
/***/ (function(module, exports, __webpack_require__) {

var disposed = false
function injectStyle (ssrContext) {
  if (disposed) return
  __webpack_require__(365)
  __webpack_require__(368)
}
var normalizeComponent = __webpack_require__(8)
/* script */
var __vue_script__ = __webpack_require__(370)
/* template */
var __vue_template__ = __webpack_require__(372)
/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-403b012c"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  __vue_script__,
  __vue_template__,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)
Component.options.__file = "resources\\assets\\js\\pages\\auth\\Login.vue"

/* hot reload */
if (false) {(function () {
  var hotAPI = require("vue-hot-reload-api")
  hotAPI.install(require("vue"), false)
  if (!hotAPI.compatible) return
  module.hot.accept()
  if (!module.hot.data) {
    hotAPI.createRecord("data-v-403b012c", Component.options)
  } else {
    hotAPI.reload("data-v-403b012c", Component.options)
  }
  module.hot.dispose(function (data) {
    disposed = true
  })
})()}

module.exports = Component.exports


/***/ }),

/***/ 365:
/***/ (function(module, exports, __webpack_require__) {

// style-loader: Adds some css to the DOM by adding a <style> tag

// load the styles
var content = __webpack_require__(366);
if(typeof content === 'string') content = [[module.i, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var update = __webpack_require__(16)("af21fbc4", content, false, {});
// Hot Module Replacement
if(false) {
 // When the styles change, update the <style> tags
 if(!content.locals) {
   module.hot.accept("!!../../../../../node_modules/css-loader/index.js!../../../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-403b012c\",\"scoped\":true,\"hasInlineConfig\":true}!../../../../../node_modules/sass-loader/lib/loader.js!../../../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Login.vue", function() {
     var newContent = require("!!../../../../../node_modules/css-loader/index.js!../../../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-403b012c\",\"scoped\":true,\"hasInlineConfig\":true}!../../../../../node_modules/sass-loader/lib/loader.js!../../../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Login.vue");
     if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
     update(newContent);
   });
 }
 // When the module is disposed, remove the <style> tags
 module.hot.dispose(function() { update(); });
}

/***/ }),

/***/ 366:
/***/ (function(module, exports, __webpack_require__) {

var escape = __webpack_require__(324);
exports = module.exports = __webpack_require__(15)(false);
// imports


// module
exports.push([module.i, "\n.index-background[data-v-403b012c] {\n  background: url(" + escape(__webpack_require__(367)) + ") no-repeat center center;\n  background-size: 100% 100%;\n}\n", ""]);

// exports


/***/ }),

/***/ 367:
/***/ (function(module, exports) {

module.exports = "/images/login_background.jpg?7b25d36a453288adcf065b4bfc2cfbbf";

/***/ }),

/***/ 368:
/***/ (function(module, exports, __webpack_require__) {

// style-loader: Adds some css to the DOM by adding a <style> tag

// load the styles
var content = __webpack_require__(369);
if(typeof content === 'string') content = [[module.i, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var update = __webpack_require__(16)("4c3cf602", content, false, {});
// Hot Module Replacement
if(false) {
 // When the styles change, update the <style> tags
 if(!content.locals) {
   module.hot.accept("!!../../../../../node_modules/css-loader/index.js!../../../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-403b012c\",\"scoped\":false,\"hasInlineConfig\":true}!../../../../../node_modules/sass-loader/lib/loader.js!../../../../../node_modules/vue-loader/lib/selector.js?type=styles&index=1!./Login.vue", function() {
     var newContent = require("!!../../../../../node_modules/css-loader/index.js!../../../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-403b012c\",\"scoped\":false,\"hasInlineConfig\":true}!../../../../../node_modules/sass-loader/lib/loader.js!../../../../../node_modules/vue-loader/lib/selector.js?type=styles&index=1!./Login.vue");
     if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
     update(newContent);
   });
 }
 // When the module is disposed, remove the <style> tags
 module.hot.dispose(function() { update(); });
}

/***/ }),

/***/ 369:
/***/ (function(module, exports, __webpack_require__) {

exports = module.exports = __webpack_require__(15)(false);
// imports


// module
exports.push([module.i, "\n.index-background .el-form-item__label:before {\n  color: transparent !important;\n}\n", ""]);

// exports


/***/ }),

/***/ 370:
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function($) {

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _util = __webpack_require__(42);

var _util2 = _interopRequireDefault(_util);

var _auth = __webpack_require__(371);

var _auth2 = _interopRequireDefault(_auth);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//

exports.default = {
  data: function data() {
    return {
      loginModel: {
        username: '',
        password: ''
      },
      ruleValidate: {
        username: [{ required: true, message: '账户不能为空', trigger: 'blur' }],
        password: [{ required: true, message: '密码不能为空', trigger: 'blur' }]
      }
    };
  },
  mounted: function mounted() {
    this.watchWindowHeight();
  },
  created: function created() {
    //      this.watchWindowHeight()
    console.log('login');
  },
  methods: {
    login: function login() {
      var self = this;
      self.$refs['loginModel'].validate(function (valid) {
        if (valid) {
          self.isLoading = true;
          self.loginCheck();
        } else {}
      });
    },
    loginCheck: function loginCheck() {
      var self = this;
      var afterLoginSuccess = function afterLoginSuccess(response) {
        console.log(response);
        _util2.default.setAuthAccessToken(response.data.data.api_token);
        _auth2.default.fetchUser(function (user) {
          var authRedirectUrl = _util2.default.getAuthRedirect();
          self.isLoading = false;
          _util2.default.login(user);
          self.$router.push({
            path: authRedirectUrl
          });
        });
      };
      var afterLoginFailed = function afterLoginFailed(error) {
        self.isLoading = false;
      };
      // console.log(res);
      _auth2.default.login({
        username: self.loginModel.username,
        password: self.loginModel.password
      }, afterLoginSuccess, afterLoginFailed);
    },
    watchWindowHeight: function watchWindowHeight() {
      var height = document.documentElement.clientHeight;
      $("#index-background").css('height', height);
      window.onresize = function temp() {
        height = document.documentElement.clientHeight;
        $("#index-background").css('height', height);
      };
    }
  },
  computed: {},
  watch: {}
};
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(17)))

/***/ }),

/***/ 371:
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
  value: true
});
/**
 * Created by 大发 on 2018/01/22.
 */
exports.default = {
  /**
   * 获取当前登录用户
   * @param cb
   */
  fetchUser: function fetchUser(cb) {
    axios.get('/api/admin/profile', { params: { include: 'profile' } }).then(function (response) {
      // console.log('Susscee:', response)
      cb(response.data.data);
    });
  },

  /**
   * 登录
   * @param loginAttempts
   * @param cb
   */
  /**
   * 登录
   * @param loginAttempts
   * @param cb
   */
  login: function login(loginAttempts, cb, cbError) {
    // console.log('login');
    axios.post('api/auth/login', {
      username: loginAttempts.username,
      password: loginAttempts.password
    }).then(function (response) {
      cb(response);
    }).catch(function (error) {
      cbError(error);
    });
  },
  /**
   *
   * @param cb
   */
  logout: function logout(cb) {
    axios.post('/logout').then(function (response) {
      cb(response);
    });
  }
};

/***/ }),

/***/ 372:
/***/ (function(module, exports, __webpack_require__) {

var render = function() {
  var _vm = this
  var _h = _vm.$createElement
  var _c = _vm._self._c || _h
  return _c(
    "div",
    {
      staticClass: "index-background container-fluid d-flex align-items-center",
      attrs: { id: "index-background" }
    },
    [
      _c(
        "div",
        {
          staticClass: "login_container col-2 offset-7",
          staticStyle: { "min-width": "50px!important" }
        },
        [
          _c(
            "el-form",
            {
              ref: "loginModel",
              attrs: {
                model: _vm.loginModel,
                rules: _vm.ruleValidate,
                "label-position": "left",
                "label-width": "30px"
              }
            },
            [
              _c(
                "el-form-item",
                { attrs: { label: " ", prop: "username" } },
                [
                  _c(
                    "el-col",
                    { attrs: { span: 24 } },
                    [
                      _c("el-input", {
                        attrs: { placeholder: "请输入用户名" },
                        model: {
                          value: _vm.loginModel.username,
                          callback: function($$v) {
                            _vm.$set(_vm.loginModel, "username", $$v)
                          },
                          expression: "loginModel.username"
                        }
                      })
                    ],
                    1
                  )
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "el-form-item",
                { attrs: { label: " ", prop: "password" } },
                [
                  _c(
                    "el-col",
                    { attrs: { span: 24 } },
                    [
                      _c("el-input", {
                        attrs: { type: "password", placeholder: "请输入密码" },
                        model: {
                          value: _vm.loginModel.password,
                          callback: function($$v) {
                            _vm.$set(_vm.loginModel, "password", $$v)
                          },
                          expression: "loginModel.password"
                        }
                      })
                    ],
                    1
                  )
                ],
                1
              ),
              _vm._v(" "),
              _c(
                "el-form-item",
                { attrs: { label: "" } },
                [
                  _c(
                    "el-col",
                    { attrs: { span: 24 } },
                    [
                      _c(
                        "el-button",
                        {
                          staticStyle: {
                            width: "100%",
                            "border-radius": "4px"
                          },
                          attrs: { type: "primary" },
                          on: { click: _vm.login }
                        },
                        [_vm._v("登陆")]
                      )
                    ],
                    1
                  )
                ],
                1
              )
            ],
            1
          )
        ],
        1
      )
    ]
  )
}
var staticRenderFns = []
render._withStripped = true
module.exports = { render: render, staticRenderFns: staticRenderFns }
if (false) {
  module.hot.accept()
  if (module.hot.data) {
    require("vue-hot-reload-api")      .rerender("data-v-403b012c", module.exports)
  }
}

/***/ })

});